package com.candy.control;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebServlet("/shopcar")
public class ShoppingCarServlet extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        获取客户端请求的信息
        String[] shopcar=req.getParameterValues("bookId");

//        将信息存放在session中
        HttpSession session=req.getSession();
        session.setAttribute("shopcar",shopcar);
//        重定向到书籍列表servlet中
        resp.sendRedirect("booklist");
    }
}
